package com.qf.collection;

import java.util.Iterator;

public class MyCollectionIterator implements Iterator {

    private Object[] arr;

    private int count;

    // 迭代器对象的起始下标
    private int index = 0;

    public MyCollectionIterator(Object[] arr,int count){
        this.arr = arr;
        this.count = count;
    }


    @Override
    public boolean hasNext() {
        return index<count;
    }

    @Override
    public Object next() {
        return arr[index++];
    }
}
